/**
 * Beijing Jiaotong University
 * Copyright (c) 1896-2016 All Rights Reserved.
 */
package com.fesc.trade.demo.request;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import com.alibaba.fastjson.annotation.JSONField;
import com.fesc.trade.demo.util.AssertUtil;

/**
 * 抽象参数类
 * @author HuHui
 * @version $Id: BaseRequest.java, v 0.1 2016年7月8日 下午3:31:41 HuHui Exp $
 */
public abstract class BaseRequest implements Serializable {

    /** uid */
    private static final long serialVersionUID = -7977401051608913047L;

    /**------------------------公共请求参数--------------------------*/

    /** (必填)收单机构编号 */
    @JSONField(name = "acquirer_id")
    protected String          acquirerId;

    /** (必填)签名类型 */
    @JSONField(name = "sign_type")
    protected String          signType;

    /** (必填)签名 */
    protected String          sign;

    /** (必填)发送请求时间 */
    protected String          timestamp;

    /** (选填) */
    @JSONField(name = "app_auth_token")
    protected String          appAuthToken;

    /** (必填)付款渠道 */
    @JSONField(name = "wallet_type")
    protected String          walletType;

    @JSONField(name = "biz_content")
    protected String          bizContent;

    /**
     * 参数校验
     */
    public void validate() {

        AssertUtil.assertNotEmpty(acquirerId, "收单机构编号不能为空");

        AssertUtil.assertNotEmpty(signType, "签名类型不能为空");

        AssertUtil.assertNotEmpty(sign, "签名不能为空");

        AssertUtil.assertNotEmpty(timestamp, "发送请求时间不能为空");

        AssertUtil.assertNotEmpty(walletType, "付款渠道不能为空");

    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
    }

    public String getAcquirerId() {
        return acquirerId;
    }

    public void setAcquirerId(String acquirerId) {
        this.acquirerId = acquirerId;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public String getTimestamp() {
        return timestamp;
    }

    public void setTimestamp(String timestamp) {
        this.timestamp = timestamp;
    }

    public String getAppAuthToken() {
        return appAuthToken;
    }

    public void setAppAuthToken(String appAuthToken) {
        this.appAuthToken = appAuthToken;
    }

    public String getWalletType() {
        return walletType;
    }

    public void setWalletType(String walletType) {
        this.walletType = walletType;
    }

    public String getBizContent() {
        return bizContent;
    }

    public void setBizContent(String bizContent) {
        this.bizContent = bizContent;
    }

}
